home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
c
/
stdio
/
RCS
/
fopen.c,v
< prev
next >
Wrap
Text File
|
1991-12-02
|
3KB
|
172 lines
head 1.4;
branch ;
access ;
symbols sprited:1.4.1;
locks ; strict;
comment @ * @;
1.4
date 88.07.29.18.56.33; author ouster; state Exp;
branches 1.4.1.1;
next 1.3;
1.3
date 88.07.25.14.10.25; author ouster; state Exp;
branches ;
next 1.2;
1.2
date 88.07.25.13.12.51; author ouster; state Exp;
branches ;
next 1.1;
1.1
date 88.06.10.16.23.45; author ouster; state Exp;
branches ;
next ;
1.4.1.1
date 91.12.02.19.57.00; author kupfer; state Exp;
branches ;
next ;
desc
@@
1.4
log
@Lint.
@
text
@/*
* fopen.c --
*
* Source code for the "fopen" library procedure.
*
* Copyright 1988 Regents of the University of California
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies. The University of California
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*/
#ifndef lint
static char rcsid[] = "$Header: fopen.c,v 1.3 88/07/25 14:10:25 ouster Exp $ SPRITE (Berkeley)";
#endif not lint
#include "stdio.h"
#include "fileInt.h"
#include "stdlib.h"
#include <sys/file.h>
extern long lseek();
/*
*----------------------------------------------------------------------
*
* fopen --
*
* Open a file and associate a buffered stream with the open file.
*
* Results:
* The return value is a stream that may be used to access
* the file, or NULL if an error occurred in opening the file.
*
* Side effects:
* A file is opened, and a stream is initialized.
*
*----------------------------------------------------------------------
*/
FILE *
fopen(fileName, access)
char *fileName; /* Name of file to be opened. */
char *access; /* Indicates type of access: "r" for reading,
* "w" for writing, "a" for appending, "r+"
* for reading and writing, "w+" for reading
* and writing with initial truncation, "a+"
* for reading and writing with initial
* position at the end of the file. The
* letter "b" may also appear in the string,
* for ANSI compatibility, but only after
* the first letter. It is ignored. */
{
int streamID, flags;
flags = StdioFileOpenMode(access);
if (flags == -1) {
return (FILE *) NULL;
}
streamID = open(fileName, flags, 0666);
if (streamID < 0) {
return (FILE *) NULL;
}
if (access[0] == 'a') {
(void) lseek(streamID, 0L, L_XTND);
}
/*
* Initialize the stream structure.
*/
return fdopen(streamID, access);
}
@
1.4.1.1
log
@Initial branch for Sprite server.
@
text
@d17 1
a17 1
static char rcsid[] = "$Header: /sprite/src/lib/c/stdio/RCS/fopen.c,v 1.4 88/07/29 18:56:33 ouster Exp $ SPRITE (Berkeley)";
@
1.3
log
@Generate more complete lint library information.
@
text
@d17 1
a17 1
static char rcsid[] = "$Header: fopen.c,v 1.2 88/07/25 13:12:51 ouster Exp $ SPRITE (Berkeley)";
d69 1
a69 1
(void) lseek(streamID, 0, L_XTND);
@
1.2
log
@Lint.
@
text
@d17 1
a17 1
static char rcsid[] = "$Header: fopen.c,v 1.1 88/06/10 16:23:45 ouster Exp $ SPRITE (Berkeley)";
a57 1
char nextChar;
@
1.1
log
@Initial revision
@
text
@d17 1
a17 1
static char rcsid[] = "$Header: atoi.c,v 1.1 88/04/28 17:20:23 ouster Exp $ SPRITE (Berkeley)";
d24 2
@